The present invention relates to color processing performed by a computer, and more particularly to gamut mapping.
An image may include a color outside of the gamut of a display device on which the image is to be displayed. In this case, gamut mapping is performed to replace the color with another color in the device's gamut. For example, a digital photographic camera may generate an image with colors outside of the gamut of a computer monitor on which the image must be displayed, i.e. the source gamut 110 (FIG. 1) provided by the camera may contain a color S which is not in the monitor's gamut (“target gamut”) 120. The color S is mapped into a color S′ which is within the target gamut. The gamut mapping should preferably avoid large image distortion and be computationally inexpensive. See e.g. U.S. Pat. No. 6,560,356 B1 issued May 6, 2003 to Takahashi et al., describing gamut mapping for a color coordinate system L*a*b*.
PCT application published as WO 2005/043887 A1 on 12 May 2005, incorporated herein by reference, describes gamut mapping for a linear RGB color coordinate system. The target gamut 120 consists of all colors whose RGB coordinates are between 0 and 255 inclusive. The gamut mapping from S=(R,G,B) to S′=(R′,G′,B′) is performed in two steps as follows:
1. If at least one of the R, G, B coordinates is negative, the smallest of the negative coordinates (i.e. the negative coordinate of the largest magnitude) is subtracted from each of the R, G, B coordinates. Thus, the vector S=(R,G,B) is replaced withS1=S−min(R,G,B)×(1,1,1)   (1)Clearly, all the coordinates of S1 are non-negative. Let us denote them as R1, G1, B1.
2. If any of R1, G1, B1 is greater than 255, then S1 is scaled to within the target gamut:S′=S1*255/max(R1,G1,B1)   (2)